package com.demo.mapper;

import com.demo.pojo.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AccountMapper {
    //查询所有用户
    @Select("select * from tbl_account")
    List<Account> selectAll();

    //查询单个用户
    @Select("select * from tbl_account where id = #{id}")
    Account getById(int id);

    //删除用户
    @Delete("delete from tbl_account where id = #{id}")
    int delete(int id);

    //修改用户
    @Update("update tbl_account set name=#{name},money=#{money} where id = #{id}")
    int update(int id);

    //新增用户
    @Insert("insert into tbl_account(name,money) values(#{name},#{money})")
    int insert(Account account);

}
